<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>layout 后台大布局 - Layui</title>

    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <i th:replace="~{common :: baseUrl}"></i>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">



    <form class="layui-form layui-form-pane" action="">


        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">促销名称</label>
                <div class="layui-input-inline" style="width: 250px">
                    <input type="text" readonly name="name" th:value="${promotionSpecialOffer.name}"  autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline" >
                <label class="layui-form-label">促销单号</label>
                <div class="layui-input-inline" >
                    <input type="text" readonly id="id" name="id" th:value="${promotionSpecialOffer.id}" autocomplete="off" class="layui-input">
                </div>
            </div>

        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">采购门店</label>
                <div class="layui-input-inline">
                    <select name="merchantsId" id="merchantsId" disabled>
                        <option th:each="l : ${merchantsInformationList}" th:value="${l.id}" th:text="${l.name}" th:selected="${l.id == promotionSpecialOffer.merchantsId}">无</option>

                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">活动范围</label>
                <div class="layui-input-inline">
                    <select name="promontionScope" id="promontionScope" disabled>
                        <option value="0">不作限制</option>
                        <option th:each="l : ${memberCategoryList}" th:value="${l.id}" th:text="${l.name}" th:selected="${l.id == promotionSpecialOffer.promontionScope}">无</option>

                    </select>
                </div>
            </div>
        </div>


        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">促销模式</label>
                <div class="layui-input-inline">
                    <select name="categoryId" id="categoryId" lay-filter="categoryId" disabled>

                        <option th:each="l : ${promotionCategoryList}" th:value="${l.id}" th:text="${l.promotionPattern}" th:selected="${l.id == promotionSpecialOffer.categoryId}">无</option>

                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">促销日期</label>
                <div class="layui-input-inline">
                    <input type="text" readonly class="layui-input" th:value="${promotionSpecialOffer.startDate}" id="start" name="startDate" placeholder="yyyy-MM">
                </div>
            </div>
            -
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" readonly class="layui-input" th:value="${promotionSpecialOffer.endDate}" id="end" name="endDate" placeholder="yyyy-MM">
                </div>
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">促销周期</label>
            <div class="layui-input-block">
                <input type="checkbox" name="periodMon" disabled th:checked='${promotionSpecialOffer.periodMon}' title="周一">
                <input type="checkbox" name="periodTue" disabled th:checked="${promotionSpecialOffer.periodTue}" title="周二">
                <input type="checkbox" name="periodWed" disabled th:checked="${promotionSpecialOffer.periodWed}" title="周三">
                <input type="checkbox" name="periodThu" disabled th:checked="${promotionSpecialOffer.periodThu}" title="周四">
                <input type="checkbox" name="periodFri" disabled th:checked="${promotionSpecialOffer.periodFri}" title="周五">
                <input type="checkbox" name="periodSat" disabled th:checked="${promotionSpecialOffer.periodSat}" title="周六">
                <input type="checkbox" name="periodSun" disabled th:checked="${promotionSpecialOffer.periodSun}" title="周日">
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">文本域</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" readonly th:value="${promotionSpecialOffer.remark}" class="layui-textarea"></textarea>
            </div>
        </div>




        <!--展示数据-->
        <div>

            <table class="layui-hide" id="specialOffer" lay-filter="specialOffer" ></table>

        </div>




        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">制单人</label>
                <div class="layui-input-inline" style="width: 70px;">
                    <input type="text" readonly name="preparedBy" th:value="${promotionSpecialOffer.preparedBy}"  autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">制单日期</label>
                <div class="layui-input-inline" style="width: 150px" >
                    <input type="text" readonly name="preparedDate" th:value="${promotionSpecialOffer.preparedDate}" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" id="cancel" class="layui-btn ">返回</button>


            </div>
        </div>



    </form>


</div>
<script th:src="@{/layui/layui.js}"></script>
<script th:inline="none">
    //JavaScript代码区域
    layui.use(['element','table','form','laydate'], function(){
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var laydate = layui.laydate;
        var $ = layui.$;




        var categoryId = $("#categoryId").val();
        if(categoryId == "7001"){
            //表格初始化
            table.render({
                elem: '#specialOffer'
                ,url:baseUrl+'promotion/specialOffer/recordList'
                ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                ,width: 1200
                ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
                ,cols: [[
                    {field:'recordId', width:180, title: 'ID'}
                    ,{field:'id', width:80, title: 'ID',hide:true}
                    ,{field:'recordName', width:220, title: '菜品名称' }
                    ,{field:'priceString', width:220, title: '售价' }
                    ,{field:'specialPriceString', width:220, title: '特价'}
                    ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:195}
                ]]
                ,where: {
                    id:$("#id").val(),


                } //设定异步数据接口的额外参数

            });

        }
        if (categoryId == "7002"){
            //表格初始化
            table.render({
                elem: '#specialOffer'
                ,url:baseUrl+'promotion/specialOffer/recordList'
                ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                ,width: 1200
                ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
                ,cols: [[
                    {field:'recordId', width:180, title: 'ID'}
                    ,{field:'id', width:80, title: 'ID',hide:true}
                    ,{field:'recordName', width:220, title: '菜品名称' }
                    ,{field:'priceString', width:220, title: '售价' }
                    ,{field:'discountString', width:220, title: '折扣' }
                    ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:195}
                ]]
                ,where: {
                    id:$("#id").val(),


                } //设定异步数据接口的额外参数

            });

        }
        if (categoryId == "7003" || categoryId == "7004"){
            //表格初始化
            table.render({
                elem: '#specialOffer'
                ,url:baseUrl+'promotion/specialOffer/recordList'
                ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                ,width: 1200
                ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
                ,cols: [[
                    {field:'recordId', width:180, title: 'ID'}
                    ,{field:'id', width:80, title: 'ID',hide:true}
                    ,{field:'recordName', width:300, title: '菜品名称' }
                    ,{field:'priceString', width:300, title: '售价' }
                    ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:195}
                ]]
                ,where: {
                    id:$("#id").val(),


                } //设定异步数据接口的额外参数

            });
        }












        //取消
        $("#cancel").click(function (){
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index); //再执行关闭


        });









    });
</script>
<script>

</script>
</body>
</html>
